<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!DOCTYPE html>
<html lang="zh-cn" style="height: 100%">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <title><?=VIEW_TITLE?></title>
    <link href="<?php echo base_url('/assets/bs/'); ?>css/bootstrap.min.css" rel="stylesheet">
    <link href="<?php echo base_url('/assets/css/'); ?>my_common.css" rel="stylesheet">
    <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
</head>
<body>
<?php
$this->load->view('admin_header.php');
?>
<div class="container">
    <div id="main_div" style="max-width: 720px;margin: auto;">
        <h4 class="notice"><?php echo $gonggao; ?></h4>
        <div class="input-group" style="margin-top: 20px">
            <input type="text" class="form-control" id="new_notice">
          <span class="input-group-btn" >
            <button class="btn btn-default" type="button" onclick="change()" >更改</button>
          </span>
        </div>
    </div>
</div>
</div>
<?php
$this->load->view('footer.php');
?>
<script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>
<script src="<?php echo base_url('/assets/bs/'); ?>js/bootstrap.min.js"></script>
<script>
    function change() {
        var text = $('#new_notice').val();
        $.ajax({
            url: '<?php echo site_url('Administrator/changeNotice');?>',
            type: 'post',
            dataType: 'json',
            data: {
                gonggao: text
            },
            success: function (data) {
                if (data == 'success') {
                    $('.notice').text('公告:' + text);
                }
            }
        });
    }
</script>
</body>
</html>